import Vue from 'vue'
import Vuex from 'vuex'
import { setItem, getItem } from '@/utils/storage.js'

Vue.use(Vuex)
const tokens = 'TOUTIAO_USER'
export default new Vuex.Store({
  state: {
    // 用户的登录转态信息
    user: getItem(tokens)
  },
  mutations: {
    setUser(state, data) {
      state.user = data
      setItem(tokens, state.user)
    }
  },
  actions: {},
  modules: {}
})
